using Digitalmes.Application.Mes.Qulities.Scraps.Queries;

namespace Digitalmes.WebApi.Endpoints.Mes.Qualities;

/// <summary>
/// 【质量】报废信息终结点
/// </summary>
public sealed class ScrapEndpoint : EndpointGroupBase
{
    public override void Map(WebApplication app)
    {
        app.MapGroup(this, "mes/quality", "scrap")
            .RequireAuthorization()
            .MapGet(GetScrapInfoPagedListAsync, "list-page");
    }

    [EndpointDescription("分页获取产品报废信息")]
    public async Task<IApiResult> GetScrapInfoPagedListAsync(ISender sender, [AsParameters] GetScrapInfoListWithPagedQuery query)
    {
        var result = await sender.Send(query);
        return result.ToApiResult();
    }
}
